Section 3.4
Camera

The camera definition describes the position, projection type and properties of the camera viewing the scene. Its syntax is:

camera { [ perspective | orthographic | fisheye | ultra_wide_angle | omnimax | panoramic | cylinder FLOAT ] location <VECTOR> look_at <VECTOR> right <VECTOR> up <VECTOR> direction <VECTOR> sky <VECTOR> right <VECTOR> angle FLOAT blur_samples FLOAT aperture FLOAT focal_point <VECTOR> normal { NORMAL } }

Depending on the projection type some of the parameters are required, some are optional and some aren't used. If no projection type is given the perspective projection will be used (pinhole camera). If no camera is specified a default camera is used.

Regardless of the projection type all cameras use the "location", "look_at", "right", "up", "direction", and "sky" keywords to determine the location and orientation of the camera. Their meaning differs with the projection type used. A more detailed explanation of the camera placement follows later.


Section 3.4.1
Type of Projection

The following list explains the different projection types that can be used with the camera. The most common types are the perspective and orthographic projections.

Perspective projection: This projection represents the classic pinhole camera. The viewing angle is either determined by the length of the direction vector or by the optional keyword "angle". The viewing angle has to be larger than 0 degrees and smaller than 180 degrees.

Orthographic projection: This projection uses parallel camera rays to create an image of the scene. The size of the image is determined by the lengths of the right and up vectors. The "angle" keyword isn't used with this projection.

Fisheye projection: This is a spherical projection. The viewing angle is specified by the "angle" keyword. An angle of 180 degrees creates the "standard" fisheye while an angle of 360 degrees creates a super-fisheye ("I-see-everything-view"). If you use this projection you should get a circular image. If this isn't the case, i.e. you get an elliptical image, you should read "Aspect Ratio" .

Ultra wide angle projection: This projection is somewhat similar to the fisheye but it projects the image onto a rectangle instead of a circle. The viewing angle can be specified using the "angle" keyword.

Omnimax projection: The omnimax projection is a 180 degrees fisheye that has a reduced viewing angle in the vertical direction. In reality this projection is used to make movies that can be viewed in the dome-like Omnimax theaters. The image will look somewhat elliptical. The "angle" keyword isn't used with this projection.

Panoramic projection: This projection is called "cylindrical equirectangular projection". It overcomes the degeneration problem of the perspective projection if the viewing angle approaches 180 degrees. It uses some kind of cylindrical projection to be able to use viewing angles larger than 180 degrees with a tolerable lateral-stretching distortion. The "angle" keyword is used to determine the viewing angle.

Cylindrical projection: Using this projection the scene is projected onto a cylinder. There are four different types of cylindrical projections depending on the orientation of the cylinder and the position of the viewpoint. The viewing angle and the length of the up or right vector determine the dimensions of the camera and the visible image. The camera to use is specified by a number. The types are:

1vertical cylinder, fixed viewpoint
2horizontal cylinder, fixed viewpoint
3vertical cylinder, viewpoint moves along the cylinder's axis
4horizontal cylinder, viewpoint moves along the cylinder's axis

The "angle" keyword overrides the viewing angle specified by the "direction" keyword and vice versa.

There is no limitation to the viewing angle except for the perspective projection. If you choose viewing angles larger than 360 degrees you'll see repeated images of the scene (the way the repetition takes place depends on the camera). This might be useful for special effects.

You should note that the vista buffer can only be used with the perspective and orthographic camera.


Section 3.4.2
Focal Blur

Simulates focal depth-of-field by shooting a number of sample rays from jittered points within each pixel, and averaging the results.

The aperture setting determines the depth of the sharpness zone. Large apertures give a lot of blurring, while narrow apertures will give a wide zone of sharpness. Note that, while this behaves as a real camera does, the values for aperture are purely arbitrary, and are not related to f-stops.

The center of the "zone of sharpness" is the focal_point vector (the default focal_point is <0,0,0>).

The blur_samples value controls the maximum number of rays to use for each pixel. More rays give a smoother appearance, but is slower, although this is controlled somewhat by an adaptive mechanism that stops shooting rays when a certain degree of confidence has been reached that shooting more rays would not result in a significant change.

The confidence and variance variables control the adaptive function. The confidence value is used to determine when the samples seem to be "close enough" to the correct color. The variance value specifies an acceptable tolerance on the variance of the samples taken so far. In other words, the process of shooting sample rays is terminated when the estimated color value is very likely (as controlled by the confidence probability) near the real color value.

Since the confidence is a probability its values can range from 0 to 1 (the default is 0.9, i.e. 90%). The value for the variance should be in the range of the smallest displayable color difference (the default is 1/128).

Larger confidence values will lead to more samples, slower traces and better images. The same holds for smaller variance thresholds.

By default no focal blur is used, i.e. the default aperture is 0 and the default number of samples is 0.


Section 3.4.3
Camera Ray Perturbation

The optional keyword "normal" may be used to assign a normal pattern to the camera. All camera rays will be perturbed using this pattern. This lets you create special effects. See animated scene CAMERA2.POV for an example.

Section 3.4.4
Placing the Camera

In the following sections the placing of the camera will be further explained.

Section 3.4.4.1
Location and Look_At

Under many circumstances just two vectors in the camera statement are all you need to position the camera: location and look_at. For example:

camera { location <3,5,-10> look_at <0,2,1> }

The location is simply the X, Y, Z coordinates of the camera. The camera can be located anywhere in the ray tracing universe. The default location is <0, 0, 0>. The look_at vector tells POV-Ray to pan and tilt the camera until it is looking at the specified X, Y, Z coordinate. By default the camera looks at a point one unit in the +Z direction from the location.

The look_at specification should almost always be the last item in the camera statement. If other camera items are placed after the look_at vector then the camera may not continue to look at the specified point.


Section 3.4.4.2
The Sky Vector

Normally POV-Ray pans left or right by rotating about the Y axis until it lines up with the look_at point and then tilts straight up or down until the point is met exactly. However you may want to slant the camera sideways like an airplane making a banked turn. You may change the tilt of the camera using the "sky" vector. For example:

camera { location <3,5,-10> sky <1,1,0> look_at <0,2,1> }

This tells POV-Ray to roll the camera until the top of the camera is in line with the sky vector. Imagine that the sky vector is an antenna pointing out of the top of the camera. Then it uses the "sky" vector as the axis of rotation left or right and then to tilt up or down in line with the "sky" vector. In effect you're telling POV-Ray to assume that the sky isn't straight up. Note that the sky vector must appear before the look_at vector.

The sky vector does nothing on its own. It only modifies the way the look_at vector turns the camera. The default value for sky is <0, 1, 0>.


Section 3.4.4.3
The Direction Vector

The "direction" vector tells POV-Ray the initial direction to point the camera before moving it with look_at or rotate vectors. It may also be used to control the field of view with some types of projection. This should be done using the easier to use "angle" keyword though.

The default value is direction <0, 0, 1>

The length of the direction vector determines the field of view for the perspective projection. It is the distance from the camera location to the imaginary "view window" that you are looking through. A short direction vector gives a wide angle view while a long direction gives a narrow, telephoto view. You should be careful with small direction vector lengths, i.e. large viewing angles. You may experience distortion on the edges of your images. Objects will appear to be shaped strangely. If this happens, move the location back and make the direction vector longer or decrease the viewing angle.

If you are using the ultra wide angle, panoramic or cylindrical projection you should use a unit length direction vector to avoid strange results.

The length of the direction vector doesn't matter if one of the following projection types is used: orthographic, fisheye, or omnimax.


Section 3.4.4.4
Up and Right Vectors

The direction of the "up" and "right" vectors (together with the direction vector) determine the orientation of the camera in the scene. They are set implicitly by their default values of

right 4/3*x up y

or the "look_at" parameter (in combination with "location"). The directions of an explicitly specified right and up vector will be overridden by any following "look_at" parameter.

While some camera types ignore the length of these vectors others use it to extract valuable information about the camera settings. The following list will explain the meaning of the right and up vector for each camera type. Since the direction the vectors is always used to describe the orientation of the camera it will not be explained again.

Perspective projection: The lengths of the up and right vectors are used to set the size of the viewing window and the aspect ratio as described in detail in section "Aspect Ratio" . Since the field of view depends on the length of the direction vector (implicitly set by the "angle" keyword or explicitly set by the "direction" keyword) and the lengths of the right and up vectors you should carefully choose them in order to get the desired results.

Orthographic projection: The lengths of the right and up vector set the size of the viewing window regardless of the direction vector length, which is not used by the orthographic camera. Again the relation of the lengths is used to set the aspect ratio.

Fisheye projection: The right and up vectors are used to set the aspect ratio.

Ultra wide angle projection: The up and right vectors work in a similar way as for the perspective camera.

Omnimax projection: The omnimax projection is a 180 degrees fisheye that has a reduced viewing angle in the vertical direction. In reality this projection is used to make movies that can be viewed in the dome-like Omnimax theaters. The image will look somewhat elliptical. The "angle" keyword isn't used with this projection.

Panoramic projection: The up and right vectors work in a similar way as for the perspective camera.

Cylindrical projection: In cylinder type 1 and 3 the axis of the cylinder lies along the "up" vector and the width is determined by the length of "right" vector or it may be overridden with the "angle" vector. In type 3 the "up" vector determines how many units high the image is. For example if you have "up 4*y" on a camera at the origin. Only points from y=2 to y=-2 are visible. All viewing rays are perpendicular to the y-axis. For type 2 and 4, the cylinder lies along the "right" vector. Viewing rays for type 4 are perpendicular to the "right" vector.

Note that the up, right, and direction vectors should always remain perpendicular to each other or the image will be distorted. If this is not the case a warning message will be printed.


Section 3.4.4.4.1
Aspect Ratio

Together these vectors define the "aspect ratio" (height to width ratio) of the resulting image. The default values "up <0, 1, 0>" and "right <1.33, 0, 0>" results in an aspect ratio of about 4 to 3. This is the aspect ratio of a typical computer monitor. If you wanted a tall skinny image or a short wide panoramic image or a perfectly square image you should adjust the up and right vectors to the appropriate proportions.

Most computer video modes and graphics printers use perfectly square pixels. For example Macintosh displays and IBM S-VGA modes 640x480, 800x600 and 1024x768 all use square pixels. When your intended viewing method uses square pixels then the width and height you set with the +W and +H switches should also have the same ratio as the right and up vectors. Note that 640/480 = 4/3 so the ratio is proper for this square pixel mode.

Not all display modes use square pixels however. For example IBM VGA mode 320x200 and Amiga 320x400 modes do not use square pixels. These two modes still produce a 4/3 aspect ratio image. Therefore images intended to be viewed on such hardware should still use 4/3 ratio on their up and right vectors but the +W and +H settings will not be 4/3.

For example:

camera { location <3,5,-10> up <0,1,0> right <1,0,0> look_at <0,2,1> }

This specifies a perfectly square image. On a square pixel display like SVGA you would use +W and +H settings such as +W480 +H480 or +W600 +H600. However on the non-square pixel Amiga 320x400 mode you would want to use values of +W240 +H400 to render a square image.


Section 3.4.4.4.2
Handedness

The "right" vector also describes the direction to the right of the camera. It tells POV-Ray where the right side of your screen is. The sign of the right vector can be used to determine the handedness of the coordinate system in use. The default right statement is:

right <1.33, 0, 0>

This whole explanation needs work. DLR


The left-handed coordinate system.

This means that the +X direction is to the right. It is called a "left- handed" system because you can use your left hand to keep track of the axes. Hold out your left hand with your palm facing to your right. Stick your thumb up. Point straight ahead with your index finger. Point your other fingers to the right. Your bent fingers are pointing to the +X direction. Your thumb now points +Y. Your index finger points +Z.

To use a right-handed coordinate system, as is popular in some CAD programs and other ray tracers, make the same shape using your right hand. Your thumb still points up in the +Y direction and your index finger still points forward in the +Z direction but your other fingers now say the +X is to the left. That means that the "right" side of your screen is now in the -X direction. To tell POV-Ray to act like this this you can use a negative X value in the "right" vector like this:

right <-1.33, 0, 0>

Since X increasing to the left doesn't make much sense on a 2D screen, you now rotate the whole thing 180 degrees around by using a positive Z value in your camera's location. You end up with something like this.

camera { location <0,0,10> up <0,1,0> right <-1.33,0,0> look_at <0,0,0> }

Now when you do your ray tracer's aerobics, as explained in the section Scene Basics "Rotate" , you use your right hand to determine the direction of rotations.

In a 2 dimensional grid, X is always to the right and Y is up. The two versions of handedness arise from the question of whether Z points into the screen or out of it, and which axis in your computer model relates to up in the real world.

Architectural CAD systems, like AutoCAD, tend to use the "God's Eye" orientation that the Z axis is the elevation and is the model's up direction. This approach makes sense if you're an architect looking at a building blueprint on a computer screen. Z means up, and it increases towards you, with X and Y still across and up the screen. This is the basic right handed system.

Stand alone rendering systems, like POV-Ray, tend to consider you as a participant. You're looking at the screen as if you were a photographer standing in the scene. Up in the model is now Y, the same as up in the real world, and X is still to the right, so Z must be depth, which increases away from you into the screen. This is the basic left handed system.


Next Section
Table Of Contents